package com.qmhl.toolposition.api

import com.qmhl.toolposition.api.content.AddFriendResponse
import com.qmhl.toolposition.api.content.AgreeResponse
import com.qmhl.toolposition.api.content.BannerResponse
import com.qmhl.toolposition.api.content.ContentWrapper
import com.qmhl.toolposition.api.content.DelFriendResponse
import com.qmhl.toolposition.api.content.FeedBackResponse
import com.qmhl.toolposition.api.content.FriendListResponse
import com.qmhl.toolposition.api.content.FriendMsgResponse
import com.qmhl.toolposition.api.content.GoodsResponse
import com.qmhl.toolposition.api.content.OneKeyLoginResponse
import com.qmhl.toolposition.api.content.PayResponse
import com.qmhl.toolposition.api.content.PrivacyAgreementResponse
import com.qmhl.toolposition.api.content.QQContactResponse
import com.qmhl.toolposition.api.content.SetNicknameResponse
import com.qmhl.toolposition.api.content.ShareInfoResponse
import com.qmhl.toolposition.api.content.SmoothResponse
import com.qmhl.toolposition.api.content.SmsCodeResponse
import com.qmhl.toolposition.api.content.UpdateResponse
import com.qmhl.toolposition.api.content.VipInfoWrapper
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface UserService {

    @GET("captchaImage")
    suspend fun getCaptchaImage(
    ): ContentWrapper

    @POST("login/oneKeyLogin")
    suspend fun oneKeyLogin(
        @Query(value = "appToken") appToken: String?
    ): OneKeyLoginResponse


    @POST("login/codeLogin")
    suspend fun codeLogin(
        @Query(value = "phoneNumber") phoneNumber: String?,
        @Query(value = "code") code: String?
    ): OneKeyLoginResponse

    @POST("login/getSmsCode")
    suspend fun getSmsCode(
        @Query(value = "phoneNumber") phoneNumber: String?
    ): SmsCodeResponse

    @POST("user/savePoint")
    suspend fun savePoint(
        @Query(value = "latitude") latitude: String?,
        @Query(value = "longitude") longitude: String?,
        @Query(value = "lastAddress") address: String?
    ): ContentWrapper

    @GET("user/getBanner")
    suspend fun getBanner(): BannerResponse

    @POST("user/feedBack")
    suspend fun feedBack(
        @Query(value = "problem") problem: String?,
        @Query(value = "contact") contact: String?
    ): FeedBackResponse

    @GET("user/isVip")
    suspend fun isVip(): VipInfoWrapper

    @GET("user/updateInfo")
    suspend fun updateInfo(): UpdateResponse

    @GET("user/shareInfo")
    suspend fun shareInfo(): ShareInfoResponse

    @GET("user/qqContact")
    suspend fun qqContact(): QQContactResponse


    @GET("user/trajectoryList")
    suspend fun trajectoryList(
        @Query(value = "startTime") startTime: String?,
        @Query(value = "endTime") endTime: String?,
        @Query(value = "type") type: Int?,
        @Query(value = "friendId") friendId: Long?,
    ): SmoothResponse


    @GET("order/goodList")
    suspend fun getGoodList(): GoodsResponse


    @POST("friend/agree")
    suspend fun agree(
        @Query(value = "id") id: Long?,
    ): AgreeResponse

    @POST("friend/refuse")
    suspend fun refuse(
        @Query(value = "id") id: Long?,
    ): AgreeResponse


    @GET("friend/friendList")
    suspend fun friendList(

    ): FriendListResponse

    @POST("friend/setNicename")
    suspend fun setNicename(
        @Query(value = "nickname") nickname: String?,
        @Query(value = "friendId") friendId: Long?
    ): SetNicknameResponse


    @GET("friend/getFriendMsgList")
    suspend fun getFriendMsgList(
        @Query(value = "num") num: Int?,
        @Query(value = "size") size: Int?
    ): FriendMsgResponse


    @POST("friend/addFriend")
    suspend fun addFriend(
        @Query(value = "phone") phone: String?,
    ): AddFriendResponse

    @POST("friend/delFriend")
    suspend fun delFriend(
        @Query(value = "friendId") friendId: Long?,
    ): DelFriendResponse

    @POST("pay/ashzjAppPay")
    suspend fun ashzjPay(
        @Query(value = "goodId") goodId: Long,
    ): PayResponse

    @GET("user/privacyAgreement")
    suspend fun getPrivacyAgreement(
        @Query(value = "type") type: Int,
    ): PrivacyAgreementResponse


    companion object {

        fun create(): UserService {
            return NetworkModule.provideRetrofit(NetworkModule.provideOkHttpClient())
                .create(UserService::class.java)
        }
    }
}